import {resolve} from 'path'
import {defineConfig, externalizeDepsPlugin} from 'electron-vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin()]
  },
  preload: {
    plugins: [externalizeDepsPlugin()],
    build: {
      rollupOptions: {
        input: {
          index: resolve(__dirname, 'src/preload/index.ts'),
          update: resolve(__dirname, 'src/preload/update.ts'),
          preview: resolve(__dirname, 'src/preload/preview.ts'),
          message: resolve(__dirname, 'src/preload/message.ts'),
        }
      }
    }
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src')
      }
    },
    plugins: [vue()],
    build: {
      rollupOptions: {
        input: {
          index: resolve(__dirname, 'src/renderer/src/pages/home/index.html'),
          update: resolve(__dirname, 'src/renderer/src/pages/update/index.html'),
          preview: resolve(__dirname, 'src/renderer/src/pages/preview/index.html'),
          message: resolve(__dirname, 'src/renderer/src/pages/message/index.html'),
        }
      }
    }
  }
})
